/********* Input style **********/

@mixin rangeThumbStyle() {
  height: 10px;
  width: 10px;
  border: 1px solid var(--gjs-main-dark-color);
  border-radius: 100%;
  background-color: var(--gjs-font-color);
  cursor: pointer;
}

@mixin rangeTrackStyle() {
  background-color: var(--gjs-main-dark-color);
  border-radius: 1px;
  margin-top: 3px;
  height: 3px;
}

.#{$app-prefix} {
  &label {
    line-height: 18px;
  }

  &fields {
    display: flex;
  }

  &select {
    padding: 0;
    width: 100%;

    select {
      padding-right: 10px;
    }
  }

  &select:-moz-focusring,
  &select select:-moz-focusring {
    color: transparent;
    text-shadow: 0 0 0 var(--gjs-secondary-light-color);
  }

  &input:focus,
  &button:focus,
  &btn-prim:focus,
  &select:focus,
  &select select:focus {
    outline: none;
  }

  &field {
    input,
    select,
    textarea {
      @include appearance(none);

      color: inherit;
      border: none;
      background-color: transparent;
      box-sizing: border-box;
      width: 100%;
      position: relative;
      padding: var(--gjs-input-padding);
      z-index: 1;

      &:focus {
        outline: none;
      }
    }

    input[type=number] {
      -moz-appearance: textfield;

      &::-webkit-outer-spin-button,
      &::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
      }
    }

    &-range {
      flex: 9 1 auto;
    }

    &-integer {
      input {
        padding-right: 30px;
      }
    }
  }
}

.#{$app-prefix}select option,
.#{$app-prefix}field-select option,
.#{$clm-prefix}select option,
.#{$sm-prefix}select option,
.#{$app-prefix}fields option,
.#{$sm-prefix}unit option {
  background-color: var(--gjs-main-color);
  color: var(--gjs-font-color);
}

.#{$app-prefix}field {
  background-color: var(--gjs-main-dark-color);
  border: none;
  box-shadow: none;
  border-radius: 2px;
  box-sizing: border-box;
  padding: 0;
  position: relative;

  textarea {
    resize: vertical;
  }

  .#{$app-prefix}sel-arrow {
    height: 100%;
    width: 9px;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 0;
  }

  .#{$app-prefix}d-s-arrow {
    bottom: 0;
    top: 0;
    margin: auto;
    right: var(--gjs-input-padding);
    border-top: 4px solid var(--gjs-arrow-color);
    position: absolute;
    height: 0;
    width: 0;
    border-left: 3px solid transparent;
    border-right: 4px solid transparent;
    cursor: pointer;
  }

  &-arrows {
    position: absolute;
    cursor: ns-resize;
    margin: auto;
    height: 20px;
    width: 9px;
    z-index: 10;
    bottom: 0;
    right: calc(var(--gjs-input-padding) - 2px);
    top: 0;
  }

  &-color,
  &-radio {
    width: 100%;
  }
}

.#{$app-prefix}field-color {
  input {
    padding-right: var(--gjs-color-input-padding);
    box-sizing: border-box;
  }
}

.#{$app-prefix}field-colorp {
  border-left: 1px solid var(--gjs-main-dark-color);
  box-sizing: border-box;
  height: 100%;
  padding: 2px;
  position: absolute;
  right: 0;
  top: 0;
  width: var(--gjs-color-input-padding);
  z-index: 10;

  .#{$app-prefix}checker-bg {
    height: 100%;
    width: 100%;
    border-radius: 1px;
  }
}

.#{$app-prefix}field-colorp-c {
  @extend .#{$app-prefix}checker-bg;

  height: 100%;
  position: relative;
  width: 100%;
}

.#{$app-prefix}field-color-picker {
  background-color: var(--gjs-font-color);
  cursor: pointer;
  height: 100%;
  width: 100%;
  box-shadow: 0 0 1px var(--gjs-main-dark-color);
  border-radius: 1px;
  position: absolute;
  top: 0;
}

/* ??? */
.#{$app-prefix}field-checkbox {
  padding: 0;
  width: 17px;
  height: 17px;
  display: block;
  cursor: pointer;

  input {
    display: none;
  }

  input:checked + .#{$app-prefix}chk-icon {
    border-color: rgba(255, 255, 255, 0.5);
    border-width: 0 2px 2px 0;
    border-style: solid;
  }
}

.#{$app-prefix}radio-item {
  flex: 1 1 auto;
  text-align: center;
  border-left: 1px solid var(--gjs-dark-text-shadow);

  &:first-child {
    border: none;
  }

  &:hover {
    background: var(--gjs-main-dark-color);
  }

  input {
    display: none;
  }

  input:checked + .#{$app-prefix}radio-item-label {
    background-color: rgba(255, 255, 255, 0.2);
  }

  &s {
    display: flex;
  }
}

.#{$app-prefix}radio-item-label {
  cursor: pointer;
  display: block;
  padding: var(--gjs-input-padding);
}

.#{$app-prefix}field-units {
  position: absolute;
  margin: auto;
  right: 10px;
  bottom: 0;
  top: 0;
}

.#{$app-prefix}field-unit {
  position: absolute;
  right: 10px;
  top: 3px;
  font-size: 10px;
  color: var(--gjs-arrow-color);
  cursor: pointer;
}

.#{$app-prefix}input-unit {
  text-align: center;
}

.#{$app-prefix}field-arrow-u,
.#{$app-prefix}field-arrow-d {
  position: absolute;
  height: 0;
  width: 0;
  border-left: 3px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--gjs-arrow-color);
  bottom: 4px;
  cursor: pointer;
}

.#{$app-prefix}field-arrow-u {
  border-bottom: 4px solid var(--gjs-arrow-color);
  border-top: none;
  top: 4px;
}

.#{$app-prefix}field-select {
  padding: 0;
}

.#{$app-prefix}field-range {
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 0;

  input {
    margin: 0;
    height: 100%;

    &:focus {
      outline: none;
    }

    &::-webkit-slider-thumb {
     -webkit-appearance: none;
     margin-top: -4px;

     @include rangeThumbStyle();
    }

    &::-moz-range-thumb {
     @include rangeThumbStyle();
    }

    &::-ms-thumb {
     @include rangeThumbStyle();
    }

    /* -moz-range-progress */
    &::-moz-range-track {
     @include rangeTrackStyle();
    }

    &::-webkit-slider-runnable-track {
     @include rangeTrackStyle();
    }

    &::-ms-track {
     @include rangeTrackStyle();
    }
  }
}

.#{$app-prefix}btn {
  &-prim {
    color: inherit;
    background-color: var(--gjs-main-light-color);
    border-radius: 2px;
    padding: 3px 6px;
    padding: var(--gjs-input-padding);
    cursor: pointer;
    border: none;

    &:active {
      background-color: var(--gjs-main-light-color);
    }
  }

  &--full {
    width: 100%;
  }
}

.#{$app-prefix}chk-icon {
  @include transform(rotate(45deg));

  box-sizing: border-box;
  display: block;
  height: 14px;
  margin: 0 5px;
  width: 6px;
}

.#{$app-prefix}add-trasp {
  background: none;
  border: none;
  color: var(--gjs-font-color);
  cursor: pointer;
  font-size: 1em;
  border-radius: 2px;

  @include opacity(0.75);

  &:hover {
    @include opacity(1);
  }

  &:active {
    background-color: rgba(0, 0, 0, 0.2);
  }
}
